

package top.continew.admin.controller.question;

import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;
import top.continew.admin.question.manger.service.DictionaryService;
import top.continew.starter.log.annotation.Log;
import top.continew.starter.web.model.R;

@Log(module = "字典")
@Tag(name = "字典 API")
@RestController
@RequestMapping("dictionary")
public class DictionaryController {
    private DictionaryService dictionaryService;

    public DictionaryController(DictionaryService dictionaryService) {
        this.dictionaryService = dictionaryService;
    }

    @GetMapping("/type:{type}")
    public R getList(@PathVariable String type) throws Exception {
        return R.ok(dictionaryService.getList(type));
    }

    @GetMapping("/info/question")
    public R question() throws Exception {
        return R.ok(dictionaryService.question());
    }

    @GetMapping("/info/paper")
    public R paper() throws Exception {
        return R.ok(dictionaryService.paper());
    }

    @GetMapping("/info/questionBankView")
    public R questionBankView() throws Exception {
        return R.ok(dictionaryService.questionBankView());
    }

    @GetMapping("/info/questionBank")
    public R questionBank() throws Exception {
        return R.ok(dictionaryService.questionBank());
    }

    @GetMapping("/select/teacher")
    public R teacher(@RequestParam(value = "name") String name) throws Exception {
        return R.ok(dictionaryService.teacher(name));
    }

    @GetMapping("/select/area")
    public R area(@RequestParam(value = "name") String name) throws Exception {
        return R.ok(dictionaryService.area(name));
    }

    @GetMapping("/select/knowledgePoint")
    public R knowledgePoint(@RequestParam(value = "name") String name) throws Exception {
        return R.ok(dictionaryService.point(name));
    }
}
